<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>用户信息</title>
		<link rel='stylesheet' type='text/css' href='/static/view/css/common.css'/>
		<link rel='stylesheet' type='text/css' href='/static/view/css/head.css'/>
                <style type="text/css">
                    input{
                        border: 1px solid #BDD7E3;height: 25px;
                    }
                </style>
	</head>
	<body>
		
	<div id='head'>
		<div id='head-navi'><a href='http://localhost:8080/index.php' onclick="setHomepage('http://localhost:8080/index.php')">设为首页</a>&nbsp;<b>|</b>&nbsp;<a href='http://localhost:8080/index.php' onclick="alert('请按Ctrl+D添加到收藏夹')">收藏本站</a></div>
		<div id='head-navi-bottom'>
                    <div class='logo'><a href='/User/forum/forum.html' onfocus="this.blur()"><img src='/static/view/image/banner/logo.png'/></a></div>
                    <div class='status'>
                        <?php if(empty($_SESSION['userInfo'])){ echo "<a href='/User/user/login'>登录</a> | "; echo "<a href='/User/user/register'>注册</a>"; }else if($_SESSION['userInfo']['role']=='普通用户'){ echo '欢迎会员<a href='.'/User/user/userInfo?id='.$_SESSION['userInfo']['id'].'>'.$_SESSION['userInfo']['username'].'</a>登录'.'<br/>'.'积分：'.$_SESSION['userInfo']['credits'].'&nbsp;|&nbsp;'.'用户组:'.$_SESSION['userInfo']['role']; echo "      <a href='/User/user/logout/'><input type='button' value='安全退出'></a>"; }else if($_SESSION['userInfo']['role']=='管理员'){ echo '欢迎管理员<a href='.'/User/user/userInfo?id='.$_SESSION['userInfo']['id'].'>'.$_SESSION['userInfo']['username'].'</a>登录'.'<br/>'.'积分：'.$_SESSION['userInfo']['credits'].'&nbsp;|&nbsp;'.'用户组:'.$_SESSION['userInfo']['role']; echo '&nbsp;|&nbsp;<a href="/Admin/user/userList">进入管理中心</a>'; echo "&nbsp;|&nbsp;<a href='/User/user/logout/'><font><b>安全退出</b></font></a>"; } ?>
                    </div>	
            </div>
	</div>
	
	<div id='navi'>
            <ul>
                <li><a href='/User/forum/forum.html'>论坛</a></li>
                <!--<li><a href='/User/user/login.html'>登录</a></li>-->
                <li><a href='/User/user/register.html'>注册</a></li>
                <li><a href='/User/user/findPassword.html'>找回密码</a></li>
                <!--<li><a href='/User/posts/postsList.html'>帖子列表</a></li>-->
                <!--<li><a href='/User/user/searchForum.html'>搜索</a></li>-->
                <!--<li><a href='/User/user/notice.html'>通知</a></li>-->
                <!--<li><a href='/User/forum/aboutUs.html'>关于我们</a></li>-->
                <!--<li><a href="/User/user/logout">安全退出</a></li>-->
            </ul>
	</div>
	<div id='search'>
            <form action='/User/posts/postsSearch' method='post'>
                <label for='search-content'><span style="font-weight:700;">搜索帖子</span></label>
               
                <input id='search-content' class='content' name='theme' type='text' results="n" placeholder='帖子主题' required autocomplete="on" x-webkit-speech speech/>

                <button type='submit'>搜索</button><font style="color:blue;font-weight: 700">　<?php echo '今天是'.date('Y-m-d',time()).'　'.date('D',time()); ?>　<span id="clock"></span></font>
            </form>
	</div>
        <script type='text/javascript' src='/static/view/js/clock.js'></script>
        <script type='text/javascript'>
           startTime();
	$(document).ready(function(){
		/*$('#head-submit').live('click',function(){
                    if($.trim($('#head-username').val())==''||$.trim($('#head-password').val())==''){
                            window.location.href='./login.html';
                    }else{
                        var data=$('#head-form').serialize();
                        $.ajax({
                            url:'./',
                            data:data,
                            dataType:'html',
                            type:'post',
                            success:function(){
                                    $('#head-form').hide();
                                    $('.status').html("<h3>欢迎会员XX登录</h3>");
                            },
                            error:function(){
                                    window.alert('an error accured');
                            }	
                        });
                    }			
		});
		
		$('#head-username').keydown(function(e){
                    if(e.keyCode == 13){
                        e.preventDefault();
                        if($.trim($(this).val()) != ''){
                                $('#head-password').focus();
                        }else{
                                $(this).attr('placeholder','请输入用户名');
                        }
                    }	
		});
		
		$('#head-password').keydown(function(e){
			if(e.keyCode==13){
                            e.preventDefault();
                            if($.trim($(this).val())!=''){
                                    $('#head-submit').trigger('click');
                        }else{
                                $(this).attr('placeholder','请输入密码');
                                //window.location.href='./login.html';
                            }
			}
		});
		
	});*/
	</script>
	

                
		<div class='body'>
			<span class='title'>用户信息</span>
			<div  class="body-infor" style="width:700px;" id="user-info">
			<fieldset>
                            <legend><h3>个人资料</h3></legend>
                            <form action="/User/user/userEdit" method="post">
                                <table width="700px;" border="1px" cellspacing="0px" style="border: 1px solid #BDD7E3;">
                                    <tr>
                                        <th><label for="head-img">头像</label></th>
                                        <td colspan="3"><a href="#"><img src="<?php echo ($user["head_img"]); ?>" width="80px" id="head-img"/></a></td>
                                    </tr>
                                    <tr>
                                        <td colspan="4">
                                         <div id="img-list" style="display: none;">
                                            <input name="head_img" type="radio" value="/static/view/image/head-img/001.jpg"/><img src="/static/view/image/head-img/001.jpg" width="60px;"/>
                                            <input name="head_img" type="radio" value="/static/view/image/head-img/002.jpg"/><img src="/static/view/image/head-img/002.jpg" width="60px;"/>
                                            <input name="head_img" type="radio" value="/static/view/image/head-img/003.jpg"/><img src="/static/view/image/head-img/003.jpg" width="60px;"/>
                                            <input name="head_img" type="radio" value="/static/view/image/head-img/004.jpg"/><img src="/static/view/image/head-img/004.jpg" width="60px;"/>
                                            <input name="head_img" type="radio" value="/static/view/image/head-img/005.jpg"/><img src="/static/view/image/head-img/005.jpg" width="60px;"/>
                                            <input name="head_img" type="radio" value="/static/view/image/head-img/006.jpg"/><img src="/static/view/image/head-img/006.jpg" width="60px;"/>
                                            <input name="head_img" type="radio" value="/static/view/image/head-img/007.jpg"/><img src="/static/view/image/head-img/007.jpg" width="60px;"/>
                                            <input name="head_img" type="radio" value="/static/view/image/head-img/008.jpg"/><img src="/static/view/image/head-img/008.jpg" width="60px;"/>
                                            <input name="head_img" type="radio" value="/static/view/image/head-img/009.jpg"/><img src="/static/view/image/head-img/009.jpg" width="60px;"/><br/>
                                            <!--<input name="head_img" type="radio" value="/static/view/image/head-img/010.jpg"/><img src="/static/view/image/head-img/010.jpg" width="60px;"/>-->
                                            <input name="head_img" type="radio" value="/static/view/image/head-img/011.jpg"/><img src="/static/view/image/head-img/011.jpg" width="60px;"/>
                                            <input name="head_img" type="radio" value="/static/view/image/head-img/012.jpg"/><img src="/static/view/image/head-img/012.jpg" width="60px;"/>
                                            <input name="head_img" type="radio" value="/static/view/image/head-img/013.jpg"/><img src="/static/view/image/head-img/013.jpg" width="60px;"/>
                                            <input name="head_img" type="radio" value="/static/view/image/head-img/014.jpg"/><img src="/static/view/image/head-img/014.jpg" width="60px;"/>
                                            <input name="head_img" type="radio" value="/static/view/image/head-img/015.jpg"/><img src="/static/view/image/head-img/015.jpg" width="60px;"/>
                                            <input name="head_img" type="radio" value="/static/view/image/head-img/016.jpg"/><img src="/static/view/image/head-img/016.jpg" width="60px;"/>
                                            <input name="head_img" type="radio" value="/static/view/image/head-img/017.jpg"/><img src="/static/view/image/head-img/017.jpg" width="60px;"/>
                                            <input name="head_img" type="radio" value="/static/view/image/head-img/018.gif"/><img src="/static/view/image/head-img/018.gif" width="60px;"/>
                                            <input name="head_img" type="radio" value="/static/view/image/head-img/default.jpg"/><img src="/static/view/image/head-img/default.jpg" width="60px;"/>
                                         </div>   
                                        </td>
                                    </tr>
                                    <tr>
                                        <th><label for="uid">用户ID</label></th>
                                        <td><input readonly name="id" value="<?php echo ($user["id"]); ?>" id="uid" style="border: 0px solid #BDD7E3"></td>
                                        <th><label for="name">姓名</label></th>
                                        <td><input readonly id='name'  type='text' name='name'  value='<?php echo ($user["name"]); ?>' /></td>
                                    </tr>
                                    <tr>
                                        <th><label for="username">用户名</label></th>
                                        <td><?php echo ($user["username"]); ?></td>
                                        <th><label for="gender">性别</label></th>
                                        <td>
                                            <div id="gender"><?php echo ($user["gender"]); ?></div>
                                            <div id="gender-radio" style="display: none;">
                                                <?php if($user["gender"] == '男'): ?><input readonly name="gender" value='男' type="radio" checked="checked"/>男
                                                    <input readonly  name="gender" value='女' type="radio"/>女
                                                <?php else: ?>
                                                    <input readonly  name="gender" value='男' type="radio"/>男
                                                    <input readonly  name="gender" value='女' type="radio" checked="checked"/>女<?php endif; ?>
                                            </div> 
                                        </td>
                                    </tr>
                                    <tr>
                                        <th><label for="credits">积分</label></th>
                                        <td><?php echo ($user["credits"]); ?></td>
                                        <th><label for="birth-day">出生年月</label></th>
                                        <td><input readonly id="birth-day" name="birth_day" value='<?php echo ($user["birth_day"]); ?>' type="date" placeholder="yyyy-mm-dd"/></td>
                                    </tr>
                                    <tr>
                                        <th><label for="group">群组</label></th>
                                        <td><?php echo ($user["role"]); ?></td>
                                        <th><label for="address">地址</label></th>
                                        <td><input readonly id="address" name="address" value='<?php echo ($user["address"]); ?>' type="text" /></td>
                                    </tr>
                                    <tr>
                                        <th><label for="email">邮箱</label></th>
                                        <td><input readonly id="email" name="email" value='<?php echo ($user["email"]); ?>' type="text" /></td>
                                        <th><label for="profession">职业</label></th>
                                        <td><input readonly id="profession" name="profession" value='<?php echo ($user["profession"]); ?>' type="text"/></td>
                                    </tr>
                                    <tr>
                                        <th><label for="phone">电话</label></th>
                                        <td><input readonly id="phone" name="phone" value='<?php echo ($user["phone"]); ?>' type="text" /></td>
                                        <th><label for="register-time">注册时间</label></th>
                                        <td><?php echo ($user["register_time"]); ?></td>
                                    </tr>
                                    <?php if($user["id"] == $_SESSION['userInfo']['id']): ?><tr>
                                            <th>修改资料</th>
                                            <td colspan="1">
                                                <button type="button" id="edit" style="display: block">编辑</button>
                                                <button type="submit" id="submit" style="display: none">提交</button>
                                                <?php if($_GET['flag']==error){echo "<font color='red'>未进行任何更改</font>";} ?>
                                            </td> 
                                            <th>修改密码</th>
                                            <td colspan="2"><a href="/User/user/changePassword?user_id=<?php echo ($user["id"]); ?>"><button type="button">修改密码</button></a></td>
                                        </tr>
                                        <?php else: endif; ?>
                                </table>
                            </form>
			</fieldset>
			</div>
	
		</div>
	
	<div style="margin:20px 15px;color:#6D6D6D;">
        <div style="border-bottom: 1px solid #BDD7E3"></div>
        <div style="padding:10px 0px;line-height: 1.8;">
                <p>Copyright &copy;2012-2013 shaobo,test</p>
                <p>Welcome to our Bulletin Board System.It is our <strong>beta</strong> version,contact <a href="mailto:shaaoboo@sina.com"><font color='blue'>shaaoboo@sina.com</font></a> to give us your valuable suggestion.</p>
        </div>
</div>

        
	<script type='text/javascript' src='/static/view/js/jquery-1.8.3.js'></script>
	<script type='text/javascript'>
                function fleshVerify(){ 
                      //重载验证码
                      var time = new Date().getTime();//alert(time);
                      document.getElementById('verifyImg').src= '/User/public/verify/'+time;
                 }
		$(document).ready(function(){
                        $('#edit').click(function(){
                            $('input').attr('readonly',false);
                            $('#uid').attr('readonly',true);
                            $(this).css('display','none');
                            $('#gender').css('display','none');
                            $('#gender-radio').css('display','block');
                            $('#submit').css('display','block');
                        });
                        $('.title').click(function(){
                           $('div.body-infor').slideToggle('slow');
                       });

                        $('legend').click(function(){
                          $(this).next('form').slideToggle('fast');
                      });
                        $('#head-img').click(function(){
                            $('#img-list').slideToggle('slow');
                        });
                      
		});
	
	</script>
	</body>
</html>